package com.limbo.showapp.presenter;

import com.limbo.showapp.base.BasePresenter;
import com.limbo.showapp.bean.MenuBean;
import com.limbo.showapp.model.MenuModel;
import com.limbo.showapp.rxHttp.HttpObserver;
import com.limbo.showapp.view.IHttpView;

/**
 * Created by wangqi on 2018/9/4.
 */

public class MenuPresenter extends BasePresenter<IHttpView,MenuModel> {

    @Override
    protected MenuModel getModel() {
        return new MenuModel();
    }

    public void getMenu(){
        mModel.getMenu(new HttpObserver<MenuBean>() {
            @Override
            protected void onHttpError(Throwable e) {
                if (getView() != null)
                    getView().onError(e.getMessage());
            }

            @Override
            protected void onHttpSuccess(MenuBean bean) {
                if (getView() != null)
                    getView().onSuccess(bean);
            }
        });
    }
}
